{template 'common/header'}
<ul class="nav nav-tabs">
	<li {if $op == 'display'}class="active"{/if}><a href="{php echo $this->wurl('mem')}">会员列表</a></li>
	{if $op == 'score'}<li class="active"><a href="{php echo $this->wurl('mem',['op'=>'score','id'=>$id])}">成长星</a></li>{/if}
	{if $op=='credit'}<li class="active"><a href="{php echo $this->createWebUrl('mem',array('op'=>'credit','id'=>$mid))}">余额日志</a></li>{/if}
	{if $op=='next'}<li class="active"><a href="{php echo $this->createWebUrl('mem',array('op'=>'next','id'=>$mid))}">我的下线</a></li>{/if}
	<li><a href="{php echo $this->wurl('mbook')}">会员课程列表</a></li>
</ul>
{if $op == 'display'}
<style>
th{
	text-align: center !important;
}
td{
	text-align: center !important;
	white-space: normal !important;
	word-break: break-all !important;
	vertical-align: middle !important;
}
</style>
<form action="" method="get" class="form-horizontal" role="form">
	<div class="panel panel-info">
        <div class="panel-heading">筛选</div>
		<div class="panel-body">
               <input type="hidden" name="c" value="site" />
               <input type="hidden" name="a" value="entry" />
               <input type="hidden" name="m" value="{php echo $this->modulename}" />
               <input type="hidden" name="do" value="mem" />
			<div class="form-group">
			<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">会员昵称</label>
                <div class="col-xs-12 col-sm-2 col-lg-2">
                    <input class="form-control" name="nickname" type="text" value="{$nickname}" placeholder="">
                </div>
               	<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
                   <div class=" col-xs-12 col-sm-3 col-lg-3">
                       <button class="btn btn-sm btn-default" ><i class="fa fa-search"></i> 搜索</button>
                  	</div>
			</div>
		</div>
	</div>
</form>			
<div class="main">
	<div class="cate" style="background: white;">
		<table class="table table-hover">
			<thead>
				<tr>
					<th>ID</th>
					<th>头像</th>
					<th>昵称</th>
					<th>成长星</th>
					<th>余额</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
			{loop $list $item}
				<tr>
					<td>{$item['id']}</td>
					<td><img src="{php echo toimage($item['avatar'])}" style="width:80px;"></td>
					<td>{$item['nickname']}</td>
					<td>{$item['score']}</td>
					<td>{$item['credit']}</td>
					<td>
						<a href="{php echo $this->wurl('mem',array('op'=>'score','id'=>$item['id']))}" class="btn btn-sm btn-info">成长星记录</a>
						<a class="btn btn-warning btn-sm" href="{php echo $this->createWebUrl('mem', array('op' => 'next', 'id' => $item['id']))}">我的下线</a>
						<br/>
						<a class="btn btn-success btn-sm" href="{php echo $this->createWebUrl('mem', array('op' => 'credit', 'id' => $item['id']))}">余额日志</a>
						<a onclick="return confirm('确定删除吗？');return false;" href="{php echo $this->wurl('mem',array('op'=>'del','id'=>$item['id']))}" class="btn btn-sm btn-danger"><i class="fa fa-remove"></i> 删除</a>
					</td>
				</tr>
			{/loop}
			</tbody>
		</table>
		{$pager}
	</div>
</div>
{elseif $op=='score'}
<form action="" method="get" class="form-horizontal" role="form">
<div class="panel panel-info">
        <div class="panel-heading">筛选</div>
        <div class="panel-body">
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="junsion_listenbook" />
                <input type="hidden" name="do" value="mem" />
                <input type="hidden" name="id" value="{$id}" />
                <input type="hidden" name="op" value="score" />
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">时间</label>
                	<div class="col-xs-12 col-sm-3 col-lg-3">
                        {php echo tpl_form_field_daterange('dateline',array('start'=>date('Y-m-d H:i',$start),'end'=>date('Y-m-d H:i',$end)),true);}
                    </div> 
                	<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
                    <div class=" col-xs-12 col-sm-3 col-lg-3">
                        <button class="btn btn-default" ><i class="fa fa-search"></i> 搜索</button>
                   	</div>
                </div>
        </div>
    </div>
</form>
<div class="panel panel-default">
    <div class="table-responsive panel-body">
        <table class="table table-hover">
            <thead class="navbar-inner">
            <tr>
                <th>成长星</th>
                <th>备注</th>
                <th>时间</th>
            </tr>
            </thead>
            <tbody id="mem-list">
            {loop $list $item}
            <tr>
                <td>{$item['score']}</td>
                <td>{$item['remark']}</td>
               	<td>{php echo date('Y-m-d H:i:s',$item['createtime']);}</td>
            </tr>
            {/loop}
            </tbody>
        </table>
        {$pager}
    </div>
</div>

{elseif $op=='credit'}
<form action="" method="get" class="form-horizontal" role="form">
<div class="panel panel-info">
        <div class="panel-heading">筛选</div>
        <div class="panel-body">
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="junsion_listenbook" />
                <input type="hidden" name="do" value="mem" />
                <input type="hidden" name="id" value="{$mid}" />
                <input type="hidden" name="op" value="credit" />
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">时间</label>
                	<div class="col-xs-12 col-sm-3 col-lg-3">
                        {php echo tpl_form_field_daterange('dateline',array('start'=>date('Y-m-d H:i',$start),'end'=>date('Y-m-d H:i',$end)),true);}
                    </div> 
                	<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
                    <div class=" col-xs-12 col-sm-3 col-lg-3">
                        <button class="btn btn-default" ><i class="fa fa-search"></i> 搜索</button>
                   	</div>
                </div>
        </div>
    </div>
</form>
<div class="panel panel-default">
    <div class="table-responsive panel-body">
        <table class="table table-hover">
            <thead class="navbar-inner">
            <tr>
                <th>金额</th>
                <th>备注</th>
                <th>时间</th>
            </tr>
            </thead>
            <tbody id="mem-list">
            {loop $list $item}
            <tr>
                <td>{$item['credit']}</td>
                <td>{$item['remark']}</td>
               	<td>{php echo date('Y-m-d H:i:s',$item['createtime']);}</td>
            </tr>
            {/loop}
            </tbody>
        </table>
        {$pager}
    </div>
</div>
{elseif $op=='next'}
<style>
.account-stat-num > div{width:33.3333%; float:left; font-size:16px; text-align:center;}
.account-stat-num > div span{display:block; font-size:30px; font-weight:bold;}
</style>
<div class="panel panel-default">
	<div class="panel-heading">
		下线数据统计
	</div>
		<div class="panel-body">
			<div class="account-stat-num row">
				<div>
				一级人数<span>{if empty($first)}0{else}{$first}{/if}</span>
				</div>
				<div>
				二级人数<span>{if empty($second)}0{else}{$second}{/if}</span>
				</div>
				<div>
				三级人数<span>{if empty($third)}0{else}{$third}{/if}</span>
				</div>
			</div>
		</div>
</div>
<form action="" method="get" class="form-horizontal" role="form">
<div class="panel panel-info">
        <div class="panel-heading">筛选</div>
        <div class="panel-body">
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="junsion_listenbook" />
                <input type="hidden" name="do" value="mem" />
                <input type="hidden" name="id" value="{$mid}" />
                <input type="hidden" name="op" value="next" />
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">会员名称</label>
                    <div class="col-xs-12 col-sm-2 col-lg-2">
                        <input class="form-control" name="keyword" type="text" value="{$_GPC['keyword']}" placeholder="请输入会员名称">
                    </div>
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">分销层级</label>
                    <div class="col-xs-12 col-sm-2 col-lg-2">
                        <select name="level" class="form-control">
                        	<option value="0" {if empty($_GPC['level'])}selected{/if}>一级下线</option>
                        	<option value="1" {if $_GPC['level']==1}selected{/if}>二级下线</option>
                        	<option value="2" {if $_GPC['level']==2}selected{/if}>三级下线</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">时间</label>
                	<div class="col-xs-12 col-sm-3 col-lg-3">
                        {php echo tpl_form_field_daterange('dateline',array('start'=>date('Y-m-d H:i',$start),'end'=>date('Y-m-d H:i',$end)),true);}
                    </div> 
                	<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
                    <div class=" col-xs-12 col-sm-3 col-lg-3">
                        <button class="btn btn-default" ><i class="fa fa-search"></i> 搜索</button>
                   	</div>
                </div>
        </div>
    </div>
</form>
<div class="panel panel-default">
    <div class="table-responsive panel-body">
        <table class="table table-hover">
            <thead class="navbar-inner">
            <tr>
                <th>头像</th>
                <th>昵称</th>
                <th>时间</th>
            </tr>
            </thead>
            <tbody id="mem-list">
            {loop $list $item}
            <tr>
            	<td>
	            	<img src="{php echo toimage($item['avatar'])}" style="width:60px;">
            	</td>
                <td>{$item['nickname']}</td>
               	<td>{php echo date('Y-m-d H:i',$item['createtime']);}</td>
            </tr>
            {/loop}
            </tbody>
        </table>
        {$pager}
    </div>
</div>
{/if}

{template 'common/footer'}